package com.example.demo.controller;

import com.example.demo.entity.Test;
import com.example.demo.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by lorne on 2017/6/26.
 */
@RestController
@RequestMapping("/demo")
public class DemoController {

	@Autowired
	private DemoService demoService;

	@RequestMapping("/list")
	@ResponseBody
	public List<Test> list() {
		return demoService.list();
	}

	@RequestMapping("/save/{id}")
	@ResponseBody
	public int save(@PathVariable("id") int i) {
		return demoService.save(i);
	}

	@RequestMapping("/compensate")
	public String compensate(@RequestBody String obj) {
		Object obj1 = obj;
		return "success";
	}
}
